package o2sjsc.activity;

import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ViewMoreAdapter extends BaseAdapter {

	Activity activity;
	ArrayList<String> data;
	LayoutInflater inflater;

	public ViewMoreAdapter(Activity activity, ArrayList<String> d) {
		this.activity = activity;
		this.data = d;
		inflater = (LayoutInflater) activity
				.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
	}

	@Override
	public int getCount() {
		return data.size();
	}

	@Override
	public Object getItem(int position) {
		return position;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null)
			convertView = inflater.inflate(R.layout.list_row1, null);
		TextView tv = (TextView) convertView.findViewById(R.id.cateName);

		String item = data.get(position);

		tv.setText(item);

		return convertView;
	}

}
